package com.bdcom.autotest.interaction.bean;

import com.bdcom.autotest.interaction.http.IpCaculate;

public class Netcard {
	
	private String cardName;
	private String ip;
	private short mask;
	
	
	public Netcard( ) {
	}
	
	public Netcard(String cardName, String ip, short mask) {
		super();
		this.cardName = cardName;
		this.ip = ip;
		this.mask = mask;
	}
	
	private String mastStr ;
	private String sip ;
	private String eip ;
	private long sipLong ; 
	
	public void init() {
		
		String ip = getIp();
		short mask = getMask();
		String seg = ip + "/" + mask;
		
		mastStr = IpCaculate.getNetMask(mask+"");
		sip = IpCaculate.getStartIp(seg);
		eip = IpCaculate.getEndIp(seg);
		sipLong = IpCaculate.getIpFromString(sip);
		
	}
	
	public synchronized long getOneLongIP() {
		sipLong++;
		return sipLong;
	}
	
	
	
	
	public String getCardName() {
		return cardName;
	}
	public void setCardName(String cardName) {
		this.cardName = cardName;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public short getMask() {
		return mask;
	}
	public void setMask(short mask) {
		this.mask = mask;
	}

	public String getMastStr() {
		return mastStr;
	}

	public void setMastStr(String mastStr) {
		this.mastStr = mastStr;
	}

	public String getSip() {
		return sip;
	}

	public void setSip(String sip) {
		this.sip = sip;
	}

	public String getEip() {
		return eip;
	}

	public void setEip(String eip) {
		this.eip = eip;
	}

	@Override
	public String toString() {
		return "Netcard [cardName=" + cardName + ", ip=" + ip + ", mask=" + mask + "]";
	}
	
	
}
